from flask import Blueprint

from .advance_approval_controller import AdvanceApprovalController
from .approval_controller import ApprovalController
from .reimbursement_approval_fi_controller import ReimbursementApprovalFiController
from .reimbursement_approval_ma_controller import ReimbursementApprovalMaController
from .travel_approval_controller import TravelApprovalController

advance_approval_blueprint = Blueprint('advanceApproval', __name__)

advance_approval_controller = AdvanceApprovalController()
# 路由映射
advance_approval_blueprint.add_url_rule(
    '/getAdvanceApprovalById', view_func=advance_approval_controller.get_advance_approval_by_id, methods=['POST'])
advance_approval_blueprint.add_url_rule(
    '/getApproveAdvanceRecord', view_func=advance_approval_controller.get_approve_advance_record, methods=['POST'])
advance_approval_blueprint.add_url_rule(
    '/getAdvanceApprovalByAdvanceId', view_func=advance_approval_controller.get_advance_approval_by_travel_id, methods=['POST'])

approval_blueprint = Blueprint('approval', __name__)

approval_controller = ApprovalController()
# 路由映射
approval_blueprint.add_url_rule(
    '/updateApprovalByTravelId', view_func=approval_controller.update_approval_by_travel_id, methods=['POST'])
approval_blueprint.add_url_rule('/getTravelApply',
                                view_func=approval_controller.get_travel_apply, methods=['POST'])
approval_blueprint.add_url_rule('/approveTravelApply',
                                view_func=approval_controller.approve_travel_apply,
                                methods=['POST'])
approval_blueprint.add_url_rule('/getAdvanceApply', view_func=approval_controller.get_advance_apply, methods=['POST'])
approval_blueprint.add_url_rule('/approveAdvanceApply', view_func=approval_controller.approve_advance_apply,
                                methods=['POST'])
approval_blueprint.add_url_rule('/getReimbursementApplyMa', view_func=approval_controller.get_reimbursement_apply_ma,
                                methods=['POST'])
approval_blueprint.add_url_rule('/approveReimbursementApplyMa',
                                view_func=approval_controller.approve_reimbursement_apply_ma, methods=['POST'])
approval_blueprint.add_url_rule('/getReimbursementApplyFi', view_func=approval_controller.get_reimbursement_apply_fi,
                                methods=['POST'])
approval_blueprint.add_url_rule('/approveReimbursementApplyFi',
                                view_func=approval_controller.approve_reimbursement_apply_fi, methods=['POST'])
approval_blueprint.add_url_rule(
    '/getApprovalByTravelId1', view_func=approval_controller.get_approval_by_travel_id, methods=['POST'])
approval_blueprint.add_url_rule(
    '/add', view_func=approval_controller.add_approval, methods=['POST'])


reimbursement_approval_fi_blueprint = Blueprint('reimbursementApprovalFi',__name__)

reimbursement_approval_fi_controller = ReimbursementApprovalFiController()

reimbursement_approval_fi_blueprint.add_url_rule(
    '/getReimbursementApprovalFiByReimbursementId', view_func=reimbursement_approval_fi_controller.get_by_reimbursement_approval_fi_id_by_reimbursement_id, methods=['POST'])
# 路由映射
reimbursement_approval_fi_blueprint.add_url_rule(
    '/getApproveReimbursementRecordFi',
    view_func=reimbursement_approval_fi_controller.get_approve_reimbursement_record_fi, methods=['POST'])

reimbursement_approval_ma_blueprint = Blueprint(
    'reimbursementApprovalMa', __name__)

reimbursement_approval_ma_controller = ReimbursementApprovalMaController()

reimbursement_approval_ma_blueprint.add_url_rule(
    '/getReimbursementApprovalMaByReimbursementId', view_func=reimbursement_approval_ma_controller.get_by_reimbursement_approval_ma_id_by_reimbursement_id, methods=['POST'])

# 路由映射
reimbursement_approval_ma_blueprint.add_url_rule(
    '/getApproveReimbursementRecordMa',
    view_func=reimbursement_approval_ma_controller.get_approve_reimbursement_record_ma, methods=['POST'])

travel_approval_blueprint = Blueprint('travelApproval', __name__)

travel_approval_controller = TravelApprovalController()

travel_approval_blueprint.add_url_rule(
    '/getTravelApprovalByTravelId', view_func=travel_approval_controller.get_travel_approval_by_travel_id, methods=['POST'])

# 路由映射
travel_approval_blueprint.add_url_rule(
    '/getApproveTravelRecord', view_func=travel_approval_controller.get_approve_travel_record, methods=['POST'])
